export function bgm() {
    $('<div class="onoff"><a href="javascript:void(0)" class="open" id="onoffclick"></a><audio id="sourcesrc" loop preload="preload"><source src="images/bgm.mp3" type="audio/mpeg"></audio></div>').prependTo('body');
    //$('<style type="text/css">.onoff .open,.onoff .close{background: url(./images/icon-music.png) 0 0 no-repeat;position: absolute;}.onoff{position: absolute;right:20px;top:20px;z-index:9998; width:63px;height:63px;}.onoff .open,.onoff .close{background-position:0 0; width:63px;height:63px; overflow:hidden; display:block;}.onoff .close{background-position:0 -70px;}</style>').prependTo('head');
    document.addEventListener("WeixinJSBridgeReady", function() {
           document.getElementById("sourcesrc").play();
    },false);

    var onoffClick = document.getElementById('onoffclick');
	onoffClick.addEventListener("click", function(event){
		var _this = $(this);
		var Media = document.getElementById("sourcesrc");
		if(_this.attr("class")=="open"){
			_this.attr("class","close");
			Media.pause();
		}else{
			_this.attr("class","open");
			Media.play();
		}
	});

}

/*export function playBGM(){
	document.getElementById('sourcesrc').play();
    $("#onoffclick").removeClass().addClass("open");
}
export function	pauseBGM(){
	document.getElementById("sourcesrc").pause();
    $("#onoffclick").removeClass().addClass("close");
}*/



